package com.dyy.proxy.jdk.dynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @author dingyy@jccfc.com
 * @since 2021/12/12 22:03
 */
public class AdminServiceJdkDynamicProxy {

    private final Object target;

    private final InvocationHandler invocationHandler;

    public AdminServiceJdkDynamicProxy(Object target, InvocationHandler invocationHandler) {
        this.target = target;
        this.invocationHandler = invocationHandler;
    }

    public Object getPersonProxy(){
        return Proxy.newProxyInstance(target.getClass()
            .getClassLoader(), target.getClass()
            .getInterfaces(), invocationHandler);
    }
}
